package cn.com.huzo.repository.purchase.impl;

import cn.com.huzo.model.entities.purchase.NonMaterialCostLinesEntity;
import cn.com.huzo.repository.purchase.NonMaterialCostLinesRepository;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;

/**
 * 非材料花费明细数据访问对象。
 *
 * @author 吴旭
 */
@Repository("NonMaterialCostLinesRepository")
public class NonMaterialCostLinesRepositoryImpl extends GenericRepositoryImpl<NonMaterialCostLinesEntity, String>
        implements NonMaterialCostLinesRepository {

    private final String namespace = "cn.com.huzo.repository.purchase.NonMaterialCostLinesRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public NonMaterialCostLinesRepositoryImpl() {
        super(NonMaterialCostLinesEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<NonMaterialCostLinesEntity> fetchByHeaderKey(Long key) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByKey"), key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<NonMaterialCostLinesEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<NonMaterialCostLinesEntity> itemsList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemsList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
